from django.db import models


class Customer(models.Model):
    """
    客户
    """
    STATUS_CHOICES = (
        (0, '禁用'),
        (1, '启用')
    )
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=32, null=True, blank=True, db_index=True, verbose_name='客户名称')
    contact_name = models.CharField(max_length=32, null=True, blank=True, db_index=True, verbose_name='联系人姓名')
    contact_phone = models.CharField(max_length=32, null=True, blank=True, db_index=True, verbose_name='联系人电话')
    contact_address = models.CharField(max_length=255, null=True, blank=True, verbose_name='联系地址')
    email = models.CharField(max_length=64, null=True, blank=True, verbose_name='邮箱')
    website = models.CharField(max_length=32, null=True, blank=True, verbose_name='门户网站')
    create_at = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_at = models.DateTimeField(auto_now=True, verbose_name='更新时间')
    status = models.IntegerField(choices=STATUS_CHOICES, default=0, verbose_name='状态')

    class Meta:
        verbose_name = '客户'
        verbose_name_plural = verbose_name
        db_table = 'biz_customer'
        ordering = ['-id']

    def __str__(self):
        return self.name
